package com.project.business.controller;

import com.project.business.service.BussinessService;
import com.project.common.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: seata-at
 * @description: 商品交易业务
 * @author: mml
 * @create: 2023/12/19
 */
@RestController
public class BussinessController {

    @Autowired
    BussinessService bussinessService;

    @PostMapping("/order")
    public RespResult order(String account, String projectId, Integer count) {
        try {
            bussinessService.purchase(account, projectId, count);
            return RespResult.success("成功");
        } catch (Exception exception) {
            return RespResult.error("下单失败",exception.getMessage());
        }
    }
}
